<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Object对象</title>
    <link rel="shortcut icon" href="../../../../favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="../../css/datatype.css">
</head>

<body>
    <div id="nav">
        <ul>
            <li><a href="./math.html">Math</a></li>
            <li><a href="./string.html">String</a></li>
            <li><a href="./object.html">Object</a></li>
            <li><a href="./array.html">Array</a></li>
            <li><a href="./date.html">Date</a></li>
        </ul>
        <div id="back">
            <a href="../../index.html">返回首页</a>
        </div>
    </div>
    <div class="container">
        <h2>对象练习</h2>
        <pre>
        let tree = {
            "id": 0,
            "name": "root",
            "left": {
                "id": 1,
                "name": "Simon",
                "left": {
                    "id": 3,
                    "name": "Carl",
                    "left": {
                        "id": 7,
                        "name": "Lee",
                        "left": {
                            "id": 11,
                            "name": "Fate"
                        }
                    },
                    "right": {
                        "id": 8,
                        "name": "Annie",
                        "left": {
                            "id": 12,
                            "name": "Saber"
                        }
                    }
                },
                "right": {
                    "id": 4,
                    "name": "Tony",
                    "left": {
                        "id": 9,
                        "name": "Candy"
                    }
                }
            },
            "right": {
                "id": 2,
                "name": "right",
                "left": {
                    "id": 5,
                    "name": "Carl",
                },
                "right": {
                    "id": 6,
                    "name": "Carl",
                    "right": {
                        "id": 10,
                        "name": "Kai"
                    }
                }
            }
        }
        </pre>
        <ul>
            <li>假设id和name均不会重复，根据输入name找到对应的id -> findIdByName(name)</li>
            <li>假设id和name均不会重复，根据输入id找到对应的name -> findNameById(id)</li>
            <li>把这个对象中所有的名字以“前序遍历”的方式全部输出到console中 -> getListWithDLR()</li>
            <li>把这个对象中所有的名字以“中序遍历”的方式全部输出到console中 -> getListWithLDR()</li>
            <li>把这个对象中所有的名字以“后序遍历”的方式全部输出到console中 -> getListWithLRD()</li>
        </ul>
    </div>

    <script src="../../js/datatype.js"></script>
    <script src="../../js/newobject.js"></script>
</body>

</html>